import request from '@/utils/request'
import { Pagination } from '@/types/global';

// 参数数据
export interface AdvertisingData {
    id?: number;
    name?: string;
    logo?: string;
    type?: number;
    subType?: number;
    path?: string;
    params?: string;
    jumpType?: number;
    sort?: number;
    status?: number;
}

// 查询参数
export interface AdvertisingParams extends Partial<AdvertisingData> {
    current?: number;
    size?: number;
    startDate?: string;
    endDate?: string;
}

// 广告列表
export function pageAdvertising(params: AdvertisingParams) {
    return request<Pagination<AdvertisingData[]>>('get', '/sys/advertising/page', {params}) 
}

// 新增广告
export function saveAdvertising(data: AdvertisingData) {
  return request('post', '/sys/advertising', data)
}

// 修改广告
export function updateAdvertising(data: AdvertisingData) {
  return request('put', '/sys/advertising', data)
}

// 删除广告
export function deleteAdvertising(ids: any) {
  return request('delete', '/sys/advertising/' + ids)
}
